﻿namespace Dyao.Book.Core
{
    public static class ExceptionExtensions
    {
        public const string DbConcurrencyExceptionKey = "IsDbConcurrencyException";

        public static bool IsDbConcurrencyException(this Exception exception)
        {
            if (exception.Data.Contains(DbConcurrencyExceptionKey) && exception.Data[DbConcurrencyExceptionKey] is bool b)
            {
                return b;
            }

            return false;
        }
    }
}
